import React, { useEffect, useTransition } from 'react'
import { connect } from 'react-redux'
import { getRankList } from '../../store/actionCreators';

function Rank(props) {
    const { rankList, getRankListDispatch } = props;
    useEffect(() => {
        // setTimeout(() => {
        //     rankList.push({ id: 2 })
        // }, 1000)不被允许
        getRankListDispatch()
    }, [])
    console.log(rankList, '///////')
    return (
        <div>
            Rank
        </div>
    )
}
const mapStateToProps = (state) => {
    return {
        rankList: state.rank.rankList
    }
}
const mapDispatchToProps = (dispatch) => {
    return {
        getRankListDispatch() {
            // 派遣一个 action getRankList()
            dispatch(getRankList())
        }
    }
}

export default connect(mapStateToProps, mapDispatchToProps)(Rank)